Micron Document
🎖️GitЯра🎖️


Displaying Raw • Download

core/ui/src/commonMain/kotlin/org/meshtastic/core/ui/component/StatusSurface.kt bf929c20f274232e0eb8ddc19b2dc82403e99e5b (bf929c20) Text, 3.14 KB

T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.ui.component

Tff7b72import T7ee787androidx.compose.foundation.background
Tff7b72import T7ee787androidx.compose.foundation.layout.Arrangement
Tff7b72import T7ee787androidx.compose.foundation.layout.PaddingValues
Tff7b72import T7ee787androidx.compose.foundation.layout.Row
Tff7b72import T7ee787androidx.compose.foundation.layout.RowScope
Tff7b72import T7ee787androidx.compose.foundation.layout.padding
Tff7b72import T7ee787androidx.compose.foundation.shape.CircleShape
Tff7b72import T7ee787androidx.compose.runtime.Composable
Tff7b72import T7ee787androidx.compose.ui.Alignment
Tff7b72import T7ee787androidx.compose.ui.Modifier
Tff7b72import T7ee787androidx.compose.ui.draw.clip
Tff7b72import T7ee787androidx.compose.ui.graphics.Color
Tff7b72import T7ee787androidx.compose.ui.graphics.Shape
Tff7b72import T7ee787androidx.compose.ui.unit.dp

T8b949e/**
* Dark backing for status-colored content. The status tokens (StatusGreen/Yellow/Orange/Red) are bright indicator
* colors that only stay legible against a dark surface, so this scrim keeps them readable on any surface (message
* bubbles, node cards) while letting them keep their true values.
*
* Slightly translucent so the surface tint shows through and it doesn't read as a harsh black box. The common cases
* (green/yellow/orange) stay at AA text contrast even over a light card; the darkest token (red) holds the 3:1
* graphical floor — see ColorContrastTest / StatusSurfaceTest.
*/
T8b949e// Alpha is at the floor for the surfaces the chip actually sits on: over the lightest real backdrop (the card surface
T8b949e// at max node tint) 0xCD is the limit before red drops under 3:1 / green under 4.5:1. One step lower (0xCC) fails AA —
T8b949e// see StatusSurfaceTest.
Tff7b72val Te6edf3StatusScrim Tff7b72= Te6edf3ColorTb4b4b4(T79c0ff0Te6edf3xCD101113Tb4b4b4)

T8b949e/**
* Wraps status-colored [content] (e.g. [Snr]/[Rssi], a signed shield) on the [StatusScrim] so the colors stay legible
* regardless of the surface underneath. [CircleShape] gives a pill for a row of content and a circle behind a solo
* icon. Render the status content in its true token color inside.
*/
Tf0883e@Composable
Tff7b72fun Td2a8ffStatusSurfaceTb4b4b4(
Te6edf3modifierTb4b4b4: Te6edf3Modifier Tff7b72= Te6edf3ModifierTb4b4b4,
Te6edf3shapeTb4b4b4: Te6edf3Shape Tff7b72= Te6edf3CircleShapeTb4b4b4,
Te6edf3contentPaddingTb4b4b4: Te6edf3PaddingValues Tff7b72= Te6edf3PaddingValuesTb4b4b4(Te6edf3horizontal Tff7b72= T79c0ff6.Te6edf3dpTb4b4b4, Te6edf3vertical Tff7b72= T79c0ff2.Te6edf3dpTb4b4b4)Tb4b4b4,
Te6edf3horizontalArrangementTb4b4b4: Te6edf3ArrangementTb4b4b4.Te6edf3Horizontal Tff7b72= Te6edf3ArrangementTb4b4b4.Te6edf3spacedByTb4b4b4(T79c0ff4.Te6edf3dpTb4b4b4)Tb4b4b4,
Te6edf3contentTb4b4b4: Tf0883e@Composable Te6edf3RowScopeTb4b4b4.Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4,
Tb4b4b4) Tb4b4b4{
Te6edf3RowTb4b4b4(
Te6edf3modifier Tff7b72= Te6edf3modifierTb4b4b4.Te6edf3clipTb4b4b4(Te6edf3shapeTb4b4b4)Tb4b4b4.Te6edf3backgroundTb4b4b4(Te6edf3StatusScrimTb4b4b4)Tb4b4b4.Te6edf3paddingTb4b4b4(Te6edf3contentPaddingTb4b4b4)Tb4b4b4,
Te6edf3verticalAlignment Tff7b72= Te6edf3AlignmentTb4b4b4.Te6edf3CenterVerticallyTb4b4b4,
Te6edf3horizontalArrangement Tff7b72= Te6edf3horizontalArrangementTb4b4b4,
Te6edf3content Tff7b72= Te6edf3contentTb4b4b4,
Tb4b4b4)
Tb4b4b4}

Served by rngit 1.5.0 - Generated in 0.04s